package com.example.qincetest

import android.content.res.Configuration
import android.content.res.Resources
import androidx.activity.ComponentActivity
import androidx.appcompat.app.AppCompatActivity
import com.example.qincetest.utils.AdaptScreenUtils

open class BaseActivity: AppCompatActivity()  {
    override fun getResources(): Resources {
        val res = super.getResources()
        //不随系统字号大小变化
        if (res.configuration.fontScale != 1f) { //非默认值
            val newConfig = Configuration()
            newConfig.setToDefaults() //设置默认
            res.updateConfiguration(newConfig, res.displayMetrics)
        }
        return AdaptScreenUtils.adaptWidth(super.getResources())
    }
}